import pandas_datareader.data as web
from sklearn.preprocessing import StandardScaler
from collections import deque
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM,Dense,Dropout
df = web.DataReader('BTC-USD', 'yahoo', start='2015-01-01', end='2022-01-2')
pre_days = 10
df['label'] = df['Close'].shift(-pre_days)
df.to_csv('look.csv')
# print(df)

sc = StandardScaler()
sc_X = sc.fit_transform(df.iloc[:, :-2])
print(sc_X)
mem_his_days = 5
deq = deque(maxlen=mem_his_days)
X = []
for i in sc_X:
    deq.append(list(i))
    if len(deq) == mem_his_days:
        X.append(list(deq))
X_lately = X[-pre_days:]
X = X[:-pre_days]
print(len(X))
print(len(X_lately))
y = df['label'].values[mem_his_days-1:-pre_days]
print(y)
X = np.array(X)
y = np.array(y)
print(X.shape, y.shape)
